UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bpBOypFL0f2+ttauV//6800J3NdCkJ0XlEreSeoLwoI=' 
WHERE 
  key_id = '0c002fe4799d08d5a1a3b76c07cc292935d6a0c19ce776348d8830b9ed4cd985' 
  AND (
    token = 'bpBOypFL0f2+ttauV//6800J3NdCkJ0XlEreSeoLwoI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027