UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PhVNCs2lqAgE2dukomVhdKYl5E2MnrPVW8Y7rRKZ0vM=' 
WHERE 
  key_id = 'b796fd62b8306383badabc682fb0447c15a7e48f8cc754b0d6253bd8013f8022' 
  AND (
    token = 'PhVNCs2lqAgE2dukomVhdKYl5E2MnrPVW8Y7rRKZ0vM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032