UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XO8XKFOT1SxlTx81JGjIOboVqtuUkLJzqGy51wfqWlI=' 
WHERE 
  key_id = 'd4340514340872b4f9258a811593a23e0c218fa9f78c2331c337430adb444738' 
  AND (
    token = 'XO8XKFOT1SxlTx81JGjIOboVqtuUkLJzqGy51wfqWlI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024