UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NXr76Q1+9TFlq8d4s8JqrDGuJ3WVf+ienBgqWUB/dXg=' 
WHERE 
  key_id = 'ee30536dfd48fcd79aadeb7f78730284ce76d5d513e1e8caca1d441e32afdc95' 
  AND (
    token = 'NXr76Q1+9TFlq8d4s8JqrDGuJ3WVf+ienBgqWUB/dXg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030