UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iAl++uXHN+JoMuVrbkYcfjS2ml/NAdVmur4f1AGYXhE=' 
WHERE 
  key_id = '2264854bdcd237558f8c83e634b2160f79310428915aa5614e804477957cb23e' 
  AND (
    token = 'iAl++uXHN+JoMuVrbkYcfjS2ml/NAdVmur4f1AGYXhE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035