UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NgI6nmQtz4RKOuXhzIBJOv50K77h1wru9/F+cELOA4Y=' 
WHERE 
  key_id = '18dd4bd37a1d75beff4e1313e84ed9d62036d6e00f9fa3f564e7e0ff21670e70' 
  AND (
    token = 'NgI6nmQtz4RKOuXhzIBJOv50K77h1wru9/F+cELOA4Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059