UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E8UGAHF3xkyPIgFeui2CsMqb2OZa+aLwUtdHPotjMe4=' 
WHERE 
  key_id = 'ed71d21eed2a0b4ec03e72b37c70c636dfde8230a7eac62896c54e499bbeec97' 
  AND (
    token = 'E8UGAHF3xkyPIgFeui2CsMqb2OZa+aLwUtdHPotjMe4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035