UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v4016TQAlJ13d1U2ALWzctrePkIGi6ISIeOJTvZjfp0=' 
WHERE 
  key_id = '13283a0117d0c6af27629c273f4064aaed7a4bc3892cb28ace13ed999757a4c1' 
  AND (
    token = 'v4016TQAlJ13d1U2ALWzctrePkIGi6ISIeOJTvZjfp0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020