UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YmiH4wAImuyZ0Uerc1Qb2IrANjRQghJ3GXHK1DR3aB8=' 
WHERE 
  key_id = '104d46350bc670c23af6845350f2ad5e5a644369b80410f1674d371f33bf6a56' 
  AND (
    token = 'YmiH4wAImuyZ0Uerc1Qb2IrANjRQghJ3GXHK1DR3aB8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024