UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pg3Gu35O+YDpoTLj3RvkPknEdU8wqJydQKwDfczhXpc=' 
WHERE 
  key_id = 'c42c11f54f38e57ac477b8c9d78f7be4fcf3dda85d06faab06ceab375d117be8' 
  AND (
    token = 'pg3Gu35O+YDpoTLj3RvkPknEdU8wqJydQKwDfczhXpc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023