UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y/O/K0dUZTAWwThvLZVeBy+NKyJ/ttIwfPNsdZRb5jg=' 
WHERE 
  key_id = '3317e59a962f18215c1b3473475f4dd52f9a022a7c1ce63ce087ab3e5c795304' 
  AND (
    token = 'Y/O/K0dUZTAWwThvLZVeBy+NKyJ/ttIwfPNsdZRb5jg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016