UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U5uYOGnG7DE0FFsR5oVo46HHKLgIvnQqN8lx5xpjKIs=' 
WHERE 
  key_id = '6955f9907122b3216401b10de4a94b86aa135e75993f0cb1b061c507aa0e5a12' 
  AND (
    token = 'U5uYOGnG7DE0FFsR5oVo46HHKLgIvnQqN8lx5xpjKIs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026