UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K1ifT7Tc3PJgKv7S1TO26npbzjYgiZr1tWj+pj4rOtA=' 
WHERE 
  key_id = '0f4608fa16fd5c2009c48d4b4dff2ecf6ebbb8d854072104fa3c60ca465788b9' 
  AND (
    token = 'K1ifT7Tc3PJgKv7S1TO26npbzjYgiZr1tWj+pj4rOtA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049