UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '48pD2fNeRWfIRA0LgRK7D0z9RDL3kxgTYcfXKjpdOGA=' 
WHERE 
  key_id = '47e14b4f4dbfd3aa33af916b96102adfcf3dbd69a5d83803840633d7bb171805' 
  AND (
    token = '48pD2fNeRWfIRA0LgRK7D0z9RDL3kxgTYcfXKjpdOGA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043