UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V24pqQ2/H/i4VfSQFmZN3FcQOYhqqSuEsYngrr+ieGA=' 
WHERE 
  key_id = '9f36765bf733a17e62ae0ac183978ce3f5651d40619efc20cd0a4ff9fb7a819f' 
  AND (
    token = 'V24pqQ2/H/i4VfSQFmZN3FcQOYhqqSuEsYngrr+ieGA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034