UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zpJ2U86IIeSQ2LGOZ7GYGzMoCsE1qOMGigVYk4BQEmQ=' 
WHERE 
  key_id = '4b8e6783391d406624479b57caf36c005291cfe949631411acf0a0c73bce0838' 
  AND (
    token = 'zpJ2U86IIeSQ2LGOZ7GYGzMoCsE1qOMGigVYk4BQEmQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041