UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SSiIlyyq6Tf9By03JTuWEPh4O4YQKizmMcihoJxtN68=' 
WHERE 
  key_id = '5d76566728699ecb40fe93f1c00e63b1cc3f2f9c30a73d317e91acbf7c00e3eb' 
  AND (
    token = 'SSiIlyyq6Tf9By03JTuWEPh4O4YQKizmMcihoJxtN68=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042