UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '47x/ymhZWmON9kLKLFO58iX1b0F8bsCz6n0pHEmNTh0=' 
WHERE 
  key_id = 'dd0d12af97697719c197dd346af0c0f2f2347ca7240d4b7bd432499dedec551a' 
  AND (
    token = '47x/ymhZWmON9kLKLFO58iX1b0F8bsCz6n0pHEmNTh0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040