UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yYdc9PGpUqNKqLmlNZQX52uHoESYZuS/bo0XclzP7OY=' 
WHERE 
  key_id = '549a1242efe5a0e0178e4b5695231f32ff26d77759da987c5acb4a364399f526' 
  AND (
    token = 'yYdc9PGpUqNKqLmlNZQX52uHoESYZuS/bo0XclzP7OY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044