UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gp3orSTL9vlAW2roC0a/EPztY64GYmx+tWVGqzChgro=' 
WHERE 
  key_id = '51d1872df40ac573a76fb4d1042d587f0a67ae28a20c25701f278d7495ce2d24' 
  AND (
    token = 'Gp3orSTL9vlAW2roC0a/EPztY64GYmx+tWVGqzChgro=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018