UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9K/pH0QBJtKJQm5ltoURUk3B5q+H3Ap3ytOoD7oOKuY=' 
WHERE 
  key_id = '50ea013d4e3a6e0d7946764756f61214b8c5ff5cc0e08008ea78dfd4f98b4a6b' 
  AND (
    token = '9K/pH0QBJtKJQm5ltoURUk3B5q+H3Ap3ytOoD7oOKuY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033