UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v+7Yu7r9sScn4Nf5qlyyYOl2SA0OwNXpZfU2sLYA+bk=' 
WHERE 
  key_id = '7e2a821b5394995af697e459199571421bfa7262489365de0dccfed774a6ed5e' 
  AND (
    token = 'v+7Yu7r9sScn4Nf5qlyyYOl2SA0OwNXpZfU2sLYA+bk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044