UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YYX8042aECRrvvM5MzfP6vZi8uzLeb513qWcNusqOEk=' 
WHERE 
  key_id = '08c11cc4888b0ce579f65e1355869dde625a47be6d6c093ed96579576096f077' 
  AND (
    token = 'YYX8042aECRrvvM5MzfP6vZi8uzLeb513qWcNusqOEk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032