UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N0/BfUcKDxRThPCS2vqMjorXXgkDX/Td2ACxO8G5q9w=' 
WHERE 
  key_id = 'ae3260e743a28eff645a0c92b1ed694e31d6cde06a26579a1c1d5632242cb395' 
  AND (
    token = 'N0/BfUcKDxRThPCS2vqMjorXXgkDX/Td2ACxO8G5q9w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029