UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yNGD89dLV/tfKlW9LkMTRQc2imRThakVA68TFBPZois=' 
WHERE 
  key_id = '4491fc68e92336a611bac85a0bd83e57663d8b19f07aaeb58854d59f584e088e' 
  AND (
    token = 'yNGD89dLV/tfKlW9LkMTRQc2imRThakVA68TFBPZois=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039