UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MPlm+2NckikB87OdA5cP9VIPTajdoIibxkCnU7jXKS8=' 
WHERE 
  key_id = 'affd7918b17418bb3e92d33fea1e928f58c183a1a481547f7e0765aef120ac2f' 
  AND (
    token = 'MPlm+2NckikB87OdA5cP9VIPTajdoIibxkCnU7jXKS8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049