UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fiEA7dqOwTJJdGGja9Gsg204S+oIyrmZqY+G1soDWxU=' 
WHERE 
  key_id = '1200053ee60d2cbac9f00369df007edebcddb9637336d6f37253e8c7afad26e2' 
  AND (
    token = 'fiEA7dqOwTJJdGGja9Gsg204S+oIyrmZqY+G1soDWxU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018