UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w0LTo21nr58U2BTU5aA6OcQQ//7FUvI4W3kTEFDiuY4=' 
WHERE 
  key_id = '4c5ffba5104da0e41f4fd581d7abd6fe21350d77f3f75efa16909351c3c64d5d' 
  AND (
    token = 'w0LTo21nr58U2BTU5aA6OcQQ//7FUvI4W3kTEFDiuY4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019