UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v/hICLNKm/2057F2EsTJjfgtE1B4WX8nVYKnNT4Qi+Y=' 
WHERE 
  key_id = '22ef721498b1f9200774ad28890f8ae3121c78acad61e939c051d4fc23668381' 
  AND (
    token = 'v/hICLNKm/2057F2EsTJjfgtE1B4WX8nVYKnNT4Qi+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039