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

Query time 0.00038