UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lWldhjr6xQrbY4HqVr3bXQF46FKsCk1mzGzc9H+zjnQ=' 
WHERE 
  key_id = '77c66a02dea43b08539d449773f0b311d2d92ecb8fad8db2b3056ef248fabdd6' 
  AND (
    token = 'lWldhjr6xQrbY4HqVr3bXQF46FKsCk1mzGzc9H+zjnQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034